import Vue from 'vue'
import dayjs from 'dayjs'
import 'dayjs/locale/zh-cn'
import relativeTime from 'dayjs/plugin/relativeTime'
dayjs.locale('zh-cn')
dayjs.extend(relativeTime)

console.log(dayjs().format('YYYY/MM/DD'))
Vue.filter('dateFormat', (value, format) => {
  if (format === 'to') {
    return dayjs().to(dayjs(value))
  }
  return dayjs(value).format(format)
})
